﻿namespace QLPhongKham.UC
{
    using ConfigDatabase.Class;
    using DevExpress.Utils;
    using DevExpress.XtraEditors;
    using DevExpress.XtraTab;
    using QLPhongKham.Access.Duoc;
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;

    public class ucd_thongso : XtraUserControl
    {
        private ConnectDatabase _condata;
        private DThongSo _tsduoc;
        private SimpleButton btnketthuc;
        private SimpleButton btnluu;
        private CheckBox chkxuat_canhbaohetdate;
        private IContainer components = null;
        private GroupControl groupControl1;
        private GroupControl groupControl2;
        private Label label1;
        private Label label2;
        private Label label25;
        private Label label3;
        private Label label4;
        private Label label5;
        private NumericUpDown numapgia_ptgiadv;
        private NumericUpDown numapgia_ptgiathuong;
        private NumericUpDown numxuat_songaycanhbaohetdate;
        private RadioButton rdbapgia_theogianhaplonnhat;
        private RadioButton rdbapgia_theophieunhap;
        private RadioButton rdbxuat_nhaptruocxuattruoc;
        private RadioButton rdbxuat_theodate;

        public ucd_thongso()
        {
            this.InitializeComponent();
        }

        private void btnketthuc_Click(object sender, EventArgs e)
        {
            try
            {
                XtraTabPage parent = (XtraTabPage) base.Parent;
                XtraTabControl control = (XtraTabControl) parent.Parent;
                control.TabPages.Remove(parent);
            }
            catch
            {
                try
                {
                    XtraUserControl control2 = (XtraUserControl) base.Parent;
                    control2.Controls.Remove(this);
                }
                catch
                {
                    ((Form) base.Parent).Close();
                }
            }
        }

        private void btnluu_Click(object sender, EventArgs e)
        {
            this.f_thongso_save();
            MessageBox.Show("Lưu th\x00e0nh c\x00f4ng.", "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK);
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void f_thongso_load()
        {
            this.rdbxuat_nhaptruocxuattruoc.Checked = this._tsduoc.pXuat_NhapTruocXuatTruoc;
            this.rdbxuat_theodate.Checked = this._tsduoc.pXuat_XuatTheoDate;
            this.numxuat_songaycanhbaohetdate.Value = Convert.ToDecimal(this._tsduoc.pXuat_CanhBaoHetDate_SoNgay);
            this.rdbapgia_theophieunhap.Checked = this._tsduoc.pApGia_TheoGiaNhap;
            this.rdbapgia_theogianhaplonnhat.Checked = this._tsduoc.pApGia_TheoGiaNhapMax;
            this.numapgia_ptgiadv.Value = Convert.ToDecimal(this._tsduoc.pApGia_PTGiaDichVu);
            this.numapgia_ptgiathuong.Value = Convert.ToDecimal(this._tsduoc.pApGia_PTGiaThuong);
        }

        private void f_thongso_save()
        {
            this._tsduoc.pXuat_NhapTruocXuatTruoc = this.rdbxuat_nhaptruocxuattruoc.Checked;
            this._tsduoc.pXuat_XuatTheoDate = this.rdbxuat_theodate.Checked;
            this._tsduoc.pXuat_CanhBaoHetDate_SoNgay = Convert.ToInt16(this.numxuat_songaycanhbaohetdate.Value);
            this._tsduoc.pApGia_TheoGiaNhap = this.rdbapgia_theophieunhap.Checked;
            this._tsduoc.pApGia_TheoGiaNhapMax = this.rdbapgia_theogianhaplonnhat.Checked;
            this._tsduoc.pApGia_PTGiaDichVu = Convert.ToInt16(this.numapgia_ptgiadv.Value);
            this._tsduoc.pApGia_PTGiaThuong = Convert.ToInt16(this.numapgia_ptgiathuong.Value);
        }

        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(ucd_thongso));
            this.btnketthuc = new SimpleButton();
            this.btnluu = new SimpleButton();
            this.rdbapgia_theophieunhap = new RadioButton();
            this.rdbapgia_theogianhaplonnhat = new RadioButton();
            this.label1 = new Label();
            this.numapgia_ptgiathuong = new NumericUpDown();
            this.label2 = new Label();
            this.label3 = new Label();
            this.label4 = new Label();
            this.numapgia_ptgiadv = new NumericUpDown();
            this.groupControl1 = new GroupControl();
            this.chkxuat_canhbaohetdate = new CheckBox();
            this.rdbxuat_nhaptruocxuattruoc = new RadioButton();
            this.label5 = new Label();
            this.rdbxuat_theodate = new RadioButton();
            this.numxuat_songaycanhbaohetdate = new NumericUpDown();
            this.groupControl2 = new GroupControl();
            this.label25 = new Label();
            this.numapgia_ptgiathuong.BeginInit();
            this.numapgia_ptgiadv.BeginInit();
            this.groupControl1.BeginInit();
            this.groupControl1.SuspendLayout();
            this.numxuat_songaycanhbaohetdate.BeginInit();
            this.groupControl2.BeginInit();
            this.groupControl2.SuspendLayout();
            base.SuspendLayout();
            this.btnketthuc.Anchor = AnchorStyles.Bottom;
            this.btnketthuc.Appearance.Options.UseTextOptions = true;
            this.btnketthuc.Appearance.TextOptions.HAlignment = HorzAlignment.Near;
            this.btnketthuc.Image = Properties.Resources.imgclose;// (Image)manager.GetObject("btnketthuc.Image");
            this.btnketthuc.Location = new Point(0x113, 0xdd);
            this.btnketthuc.Name = "btnketthuc";
            this.btnketthuc.Size = new Size(0x4f, 0x17);
            this.btnketthuc.TabIndex = 3;
            this.btnketthuc.Text = " &Kết th\x00fac";
            this.btnketthuc.Click += new EventHandler(this.btnketthuc_Click);
            this.btnluu.Anchor = AnchorStyles.Bottom;
            this.btnluu.Appearance.Options.UseTextOptions = true;
            this.btnluu.Appearance.TextOptions.HAlignment = HorzAlignment.Near;
            this.btnluu.Image = Properties.Resources.imgsave;// (Image)manager.GetObject("btnluu.Image");
            this.btnluu.Location = new Point(0xd0, 0xdd);
            this.btnluu.Name = "btnluu";
            this.btnluu.Size = new Size(0x3f, 0x17);
            this.btnluu.TabIndex = 2;
            this.btnluu.Text = " &Lưu";
            this.btnluu.Click += new EventHandler(this.btnluu_Click);
            this.rdbapgia_theophieunhap.AutoSize = true;
            this.rdbapgia_theophieunhap.Checked = true;
            this.rdbapgia_theophieunhap.Font = new Font("Tahoma", 10f);
            this.rdbapgia_theophieunhap.Location = new Point(15, 0x1b);
            this.rdbapgia_theophieunhap.Name = "rdbapgia_theophieunhap";
            this.rdbapgia_theophieunhap.Size = new Size(0xa7, 0x15);
            this.rdbapgia_theophieunhap.TabIndex = 0;
            this.rdbapgia_theophieunhap.TabStop = true;
            this.rdbapgia_theophieunhap.Text = "\x00c1p gi\x00e1 theo phiếu nhập";
            this.rdbapgia_theophieunhap.UseVisualStyleBackColor = true;
            this.rdbapgia_theogianhaplonnhat.AutoSize = true;
            this.rdbapgia_theogianhaplonnhat.Font = new Font("Tahoma", 10f);
            this.rdbapgia_theogianhaplonnhat.Location = new Point(15, 0x36);
            this.rdbapgia_theogianhaplonnhat.Name = "rdbapgia_theogianhaplonnhat";
            this.rdbapgia_theogianhaplonnhat.Size = new Size(0xb8, 0x15);
            this.rdbapgia_theogianhaplonnhat.TabIndex = 1;
            this.rdbapgia_theogianhaplonnhat.Text = "\x00c1p theo gi\x00e1 nhập lớn nhất";
            this.rdbapgia_theogianhaplonnhat.UseVisualStyleBackColor = true;
            this.label1.Font = new Font("Microsoft Sans Serif", 12f, FontStyle.Regular, GraphicsUnit.Point, 0xa3);
            this.label1.Location = new Point(0x10f, 0x26);
            this.label1.Name = "label1";
            this.label1.Size = new Size(0x19, 0x1a);
            this.label1.TabIndex = 0x17;
            this.label1.Text = "%";
            this.numapgia_ptgiathuong.Font = new Font("Microsoft Sans Serif", 12f, FontStyle.Regular, GraphicsUnit.Point, 0xa3);
            this.numapgia_ptgiathuong.Location = new Point(0xde, 0x26);
            this.numapgia_ptgiathuong.Name = "numapgia_ptgiathuong";
            this.numapgia_ptgiathuong.Size = new Size(0x33, 0x1a);
            this.numapgia_ptgiathuong.TabIndex = 2;
            this.label2.Font = new Font("Tahoma", 12f);
            this.label2.Location = new Point(0x1b0, 0x26);
            this.label2.Name = "label2";
            this.label2.Size = new Size(0x19, 0x1a);
            this.label2.TabIndex = 0x17;
            this.label2.Text = "%";
            this.label2.TextAlign = ContentAlignment.MiddleCenter;
            this.label3.Font = new Font("Microsoft Sans Serif", 12f, FontStyle.Regular, GraphicsUnit.Point, 0xa3);
            this.label3.Location = new Point(0x123, 0x26);
            this.label3.Name = "label3";
            this.label3.Size = new Size(0x6a, 0x1a);
            this.label3.TabIndex = 0x17;
            this.label3.Text = "Gi\x00e1 thường";
            this.label3.TextAlign = ContentAlignment.MiddleLeft;
            this.label4.Font = new Font("Tahoma", 12f);
            this.label4.Location = new Point(0x1c5, 0x26);
            this.label4.Name = "label4";
            this.label4.Size = new Size(0x6b, 0x1a);
            this.label4.TabIndex = 0x17;
            this.label4.Text = "Gi\x00e1 dịch vụ";
            this.label4.TextAlign = ContentAlignment.MiddleLeft;
            this.numapgia_ptgiadv.Font = new Font("Microsoft Sans Serif", 12f, FontStyle.Regular, GraphicsUnit.Point, 0xa3);
            this.numapgia_ptgiadv.Location = new Point(390, 0x26);
            this.numapgia_ptgiadv.Name = "numapgia_ptgiadv";
            this.numapgia_ptgiadv.Size = new Size(0x2c, 0x1a);
            this.numapgia_ptgiadv.TabIndex = 3;
            this.groupControl1.AppearanceCaption.Font = new Font("Tahoma", 10f, FontStyle.Bold);
            this.groupControl1.AppearanceCaption.Options.UseFont = true;
            this.groupControl1.Controls.Add(this.chkxuat_canhbaohetdate);
            this.groupControl1.Controls.Add(this.rdbxuat_nhaptruocxuattruoc);
            this.groupControl1.Controls.Add(this.label5);
            this.groupControl1.Controls.Add(this.rdbxuat_theodate);
            this.groupControl1.Controls.Add(this.numxuat_songaycanhbaohetdate);
            this.groupControl1.Location = new Point(0, 0x2e);
            this.groupControl1.Name = "groupControl1";
            this.groupControl1.Size = new Size(0x251, 80);
            this.groupControl1.TabIndex = 0;
            this.groupControl1.Text = "Xuất kho";
            this.chkxuat_canhbaohetdate.AutoSize = true;
            this.chkxuat_canhbaohetdate.Font = new Font("Tahoma", 10f);
            this.chkxuat_canhbaohetdate.Location = new Point(0x10b, 0x1b);
            this.chkxuat_canhbaohetdate.Name = "chkxuat_canhbaohetdate";
            this.chkxuat_canhbaohetdate.Size = new Size(0xd0, 0x15);
            this.chkxuat_canhbaohetdate.TabIndex = 1;
            this.chkxuat_canhbaohetdate.Text = "Cảnh b\x00e1o thuốc sắp hết Date";
            this.chkxuat_canhbaohetdate.UseVisualStyleBackColor = true;
            this.rdbxuat_nhaptruocxuattruoc.AutoSize = true;
            this.rdbxuat_nhaptruocxuattruoc.Checked = true;
            this.rdbxuat_nhaptruocxuattruoc.Font = new Font("Tahoma", 10f);
            this.rdbxuat_nhaptruocxuattruoc.Location = new Point(0x11, 0x1b);
            this.rdbxuat_nhaptruocxuattruoc.Name = "rdbxuat_nhaptruocxuattruoc";
            this.rdbxuat_nhaptruocxuattruoc.Size = new Size(0xa6, 0x15);
            this.rdbxuat_nhaptruocxuattruoc.TabIndex = 0;
            this.rdbxuat_nhaptruocxuattruoc.TabStop = true;
            this.rdbxuat_nhaptruocxuattruoc.Text = "Nhập trước xuất trước";
            this.rdbxuat_nhaptruocxuattruoc.UseVisualStyleBackColor = true;
            this.label5.Font = new Font("Tahoma", 10f);
            this.label5.Location = new Point(520, 0x1b);
            this.label5.Name = "label5";
            this.label5.Size = new Size(50, 0x15);
            this.label5.TabIndex = 0x17;
            this.label5.Text = "th\x00e1ng";
            this.rdbxuat_theodate.AutoSize = true;
            this.rdbxuat_theodate.Font = new Font("Tahoma", 10f);
            this.rdbxuat_theodate.Location = new Point(0x11, 0x34);
            this.rdbxuat_theodate.Name = "rdbxuat_theodate";
            this.rdbxuat_theodate.Size = new Size(0xe3, 0x15);
            this.rdbxuat_theodate.TabIndex = 3;
            this.rdbxuat_theodate.Text = "Xuất theo Date trước xuất trước";
            this.rdbxuat_theodate.UseVisualStyleBackColor = true;
            this.numxuat_songaycanhbaohetdate.Location = new Point(0x1e1, 0x1b);
            this.numxuat_songaycanhbaohetdate.Name = "numxuat_songaycanhbaohetdate";
            this.numxuat_songaycanhbaohetdate.Size = new Size(0x27, 0x15);
            this.numxuat_songaycanhbaohetdate.TabIndex = 2;
            this.groupControl2.AppearanceCaption.Font = new Font("Tahoma", 10f, FontStyle.Bold);
            this.groupControl2.AppearanceCaption.Options.UseFont = true;
            this.groupControl2.Controls.Add(this.rdbapgia_theophieunhap);
            this.groupControl2.Controls.Add(this.rdbapgia_theogianhaplonnhat);
            this.groupControl2.Controls.Add(this.numapgia_ptgiadv);
            this.groupControl2.Controls.Add(this.label3);
            this.groupControl2.Controls.Add(this.numapgia_ptgiathuong);
            this.groupControl2.Controls.Add(this.label4);
            this.groupControl2.Controls.Add(this.label2);
            this.groupControl2.Controls.Add(this.label1);
            this.groupControl2.Location = new Point(0, 0x7e);
            this.groupControl2.Name = "groupControl2";
            this.groupControl2.Size = new Size(0x251, 0x57);
            this.groupControl2.TabIndex = 1;
            this.groupControl2.Text = "\x00c1p gi\x00e1 b\x00e1n";
            this.label25.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.label25.BackColor = Color.Green;
            this.label25.Font = new Font("Tahoma", 16f);
            this.label25.ForeColor = Color.White;
            this.label25.Location = new Point(0, 0);
            this.label25.Name = "label25";
            this.label25.Size = new Size(0x251, 0x2d);
            this.label25.TabIndex = 0x1a;
            this.label25.Text = "TH\x00d4NG SỐ";
            this.label25.TextAlign = ContentAlignment.MiddleLeft;
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.Controls.Add(this.label25);
            base.Controls.Add(this.groupControl2);
            base.Controls.Add(this.groupControl1);
            base.Controls.Add(this.btnluu);
            base.Controls.Add(this.btnketthuc);
            this.LookAndFeel.UseWindowsXPTheme = true;
            base.Name = "ucd_thongso";
            base.Size = new Size(0x251, 0xf7);
            base.Load += new EventHandler(this.UCphanquyensudung_Load);
            this.numapgia_ptgiathuong.EndInit();
            this.numapgia_ptgiadv.EndInit();
            this.groupControl1.EndInit();
            this.groupControl1.ResumeLayout(false);
            this.groupControl1.PerformLayout();
            this.numxuat_songaycanhbaohetdate.EndInit();
            this.groupControl2.EndInit();
            this.groupControl2.ResumeLayout(false);
            this.groupControl2.PerformLayout();
            base.ResumeLayout(false);
        }

        private void UCphanquyensudung_Load(object sender, EventArgs e)
        {
            if (this._condata == null)
            {
                this._condata = new ConnectDatabase();
            }
            this._tsduoc = new DThongSo(this._condata);
            this.f_thongso_load();
        }

        public ConnectDatabase pCondata
        {
            get
            {
                return this._condata;
            }
            set
            {
                this._condata = value;
            }
        }
    }
}

